package ink.ykb.demo.user.dao;
import org.beetl.sql.core.annotatoin.Sql;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.core.mapper.BaseMapper;

import ink.ykb.demo.user.entity.UserInfo;

/*
* 
* gen by beetlsql mapper 2019-09-20
*/
public interface UserInfoDao extends BaseMapper<UserInfo> {
	
	/**
	 * 根据userName获取用户信息(加锁)
	 * 
	 * @param code
	 * @return
	 */
	@Sql("select * from user_info where user_name = ? for update")
	UserInfo getUserInfoAndLock(String userName);

	/**
	 * 根据id获取用户信息
	 * 
	 * @param id
	 * @return
	 */
	@Sql("select * from user_info where status = 1 and id = ?")
	UserInfo getUserInfoById(Long id);
	
	@Sql("select * from user_info where status = 1 and user_name = ?")
	UserInfo getUserInfo(String userName);

	PageQuery<UserInfo> getPage(PageQuery<UserInfo> query);
}
